package com.example.dbpage.tool

import android.arch.lifecycle.LiveData
import android.arch.paging.DataSource
import android.arch.persistence.room.Dao
import android.arch.persistence.room.Delete
import android.arch.persistence.room.Insert
import android.arch.persistence.room.Query
import com.example.dbpage.bean.Users

/**
 * Created by zhangfang on 2018/2/9.
 */
@Dao
interface UserDao {


    @Query("select * from Users")
    fun getAllUsers(): List<Users>

    @Query("select * from Users")
    fun getAllUsers3(): LiveData<List<Users>>

    @Query("select * from users")
    fun getALlUser4(): DataSource.Factory<Int, Users>

    @Query("select * from Users where id = (:id) ")
    fun getUserById(id: Long): Users


    @Delete
    fun delete(user: Users)


    @Insert
    fun insert(user: Users): Long

}